	<div class="loginbox">
	<img src="/images/catbox_bgtop.gif" />
		<div id="loginbox_wrapper">
			<div class="loginbox_form">		

			<div class="catmenu_title"><span>Телеком прайс</span></div>
			<?php
			function dosomething($categ, $parent, $pos, $level, $expand)
			{

			$out="";
			for ($i = $pos; $i < count($categ); $i++)
			{
				if($categ[$i]->getParentId() == $parent)
				{
					if($i != count($categ) - 1)
					{
						$undercat = dosomething($categ, $categ[$i]->getId(), $i+1, $level+1, $expand);
						
				if(strlen(trim($undercat))>2)
					$out = $out.'<li style="cursor:pointer;" ><span onclick="$(\'#menu'.$categ[$i]->getId().'\').toggleClass(\'superhidden\')">'.$categ[$i]->getTitle().'</span><ul '. ( $expand ? '' : 'class="superhidden"' ) .' id="menu'.$categ[$i]->getId().'" style="padding-left:20px; list-style-image:url(\'/images/subcat.png\');">'.$undercat.'</ul></li>';
				else 
					$out = $out.'<li style="list-style:none"><span id="spanmenu'.$categ[$i]->getId().'">'.link_to($categ[$i]->getTitle(),'catalog/index?catid='.$categ[$i]->getId()).'</span></li>';		
					
					}
					else
					{
					$out = $out.'<li style="list-style:none"><span id="spanmenu'.$categ[$i]->getId().'">'.link_to($categ[$i]->getTitle(),'catalog/index?catid='.$categ[$i]->getId()).'</span></li>';
					}
				}
			}
				return $out;
			}
			?>

			<ul style="font-size:12px; padding:0 20px; list-style-image:url('/images/subcat.png')" >
			<?php
			echo dosomething($categories, NULL, 0, 2, $expand );
			?>
			</ul>
			<div style='text-align:right'>
			<?php echo $sf_user->isAuthenticated() ? link_to('Разместить прайс','account/uploadprices') : link_to('Разместить прайс','@registration_link') ?>
			</div>
			</div>

		</div>
		<div class="loginbox_bottom"></div>
	</div>